'use strict';
module.exports = {
	/**
	 * 搜索结果
	 * @url client/course/pub/role_course 前端调用的url参数地址
	 * data 请求参数
	 * @param {String} params1  参数1
	 */
	main: async (event) => {
		let {
			data = {}, userInfo, util, filterResponse, originalParam
		} = event;
		let {
			customUtil,
			uniID,
			config,
			pubFun,
			vk,
			db,
			_
		} = util;
		let {
			uid,
			pageIndex,
			pageSize,
		} = data;
		let res = {
			code: 0,
			msg: ""
		};
		// 业务逻辑开始-----------------------------------------------------------
		let fieldJson = {}
		let dbName = "course";
		let whereJson = {
			free_roles: _.exists(true),
			free_roles: _.eq(["role1"])
		}
		res = await vk.baseDao.select({
			dbName: dbName, // 表名
			getMain: false, // 是否只返回rows数据
			pageIndex, // 当前第几页
			pageSize, // 每页条数
			sortArr: [{
				"name": "_add_time",
				"type": "desc"
			}],
			// 条件
			whereJson: whereJson
		});

		// 业务逻辑结束-----------------------------------------------------------
		return res;
	}
}